﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Web.View.d201Menu.Default" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>d201</title>
    <script src="/View/js/Alert.js" type="text/javascript"></script> 
    <script type="text/javascript">
        function SetWinData(index) {
            document.getElementById("Hid").value = d201_MainStore.getAt(index).get('dzbm');
            
			Txtgldm.setValue(d201_MainStore.getAt(index).get('gldm'));
			Txtdzmc.setValue(d201_MainStore.getAt(index).get('dzmc'));
			Txtdqbm.setValue(d201_MainStore.getAt(index).get('dqbm'));
			Txtjtdz.setValue(d201_MainStore.getAt(index).get('jtdz'));
			Txtzbh.setValue(d201_MainStore.getAt(index).get('zbh'));
			Txtcbh.setValue(d201_MainStore.getAt(index).get('cbh'));
			Txtdjjb.setValue(d201_MainStore.getAt(index).get('djjb'));
			TxtNumxzjb.setValue(d201_MainStore.getAt(index).get('xzjb'));
			TxtNumsxzs.setValue(d201_MainStore.getAt(index).get('sxzs'));
			TxtNumxzcs.setValue(d201_MainStore.getAt(index).get('xzcs'));
			TxtNumxszs.setValue(d201_MainStore.getAt(index).get('xszs'));
			TxtNumnyhs.setValue(d201_MainStore.getAt(index).get('nyhs'));
			TxtNumczrs.setValue(d201_MainStore.getAt(index).get('czrs'));
			TxtNumnyrs.setValue(d201_MainStore.getAt(index).get('nyrs'));
			TxtNumwbhs.setValue(d201_MainStore.getAt(index).get('wbhs'));
			TxtNumpkrs.setValue(d201_MainStore.getAt(index).get('pkrs'));
			TxtNumtkrs.setValue(d201_MainStore.getAt(index).get('tkrs'));
			TxtNumzzrs.setValue(d201_MainStore.getAt(index).get('zzrs'));
			TxtNumchrs.setValue(d201_MainStore.getAt(index).get('chrs'));

            d201_Win.show();
        }
    </script>
</head>
<body>
    <form id="MainForm" runat="server">
    <ext:ResourceManager ID="MainResourceMgr" runat="server" />
    <!--用来导出到Excel的数据源-->
    <ext:Hidden ID="ExcelGridData" runat="server" />
    <!--d201表页面主数据元，自动生成-->
    <ext:Store runat="server" ID="d201_MainStore" OnRefreshData="d201_DataBind" AutoLoad="true">
        <Proxy>
            <ext:PageProxy />
        </Proxy>
        <Reader>
            <ext:JsonReader IDProperty="dzbm">
                <Fields>
                    
					<ext:RecordField Name="dzbm" />
					<ext:RecordField Name="gldm" />
					<ext:RecordField Name="dzmc" />
					<ext:RecordField Name="dqbm" />
					<ext:RecordField Name="jtdz" />
					<ext:RecordField Name="zbh" />
					<ext:RecordField Name="cbh" />
					<ext:RecordField Name="djjb" />
					<ext:RecordField Name="xzjb" />
					<ext:RecordField Name="sxzs" />
					<ext:RecordField Name="xzcs" />
					<ext:RecordField Name="xszs" />
					<ext:RecordField Name="nyhs" />
					<ext:RecordField Name="czrs" />
					<ext:RecordField Name="nyrs" />
					<ext:RecordField Name="wbhs" />
					<ext:RecordField Name="pkrs" />
					<ext:RecordField Name="tkrs" />
					<ext:RecordField Name="zzrs" />
					<ext:RecordField Name="chrs" />

                </Fields>
            </ext:JsonReader>
        </Reader> 
        <BaseParams>
            <ext:Parameter Name="start" Value="0" Mode="Raw">
            </ext:Parameter>
            <ext:Parameter Name="limit" Value="15" Mode="Raw">
            </ext:Parameter>
        </BaseParams>
    </ext:Store>
    <!--d201页面主表格-->
    <ext:Viewport ID="MainViewPort" runat="server">
        <Items>
            <ext:FitLayout>
                <Items>
                    <ext:GridPanel ID="d201_Grid" Layout="fit" TrackMouseOver="true" runat="server" StoreID="d201_MainStore"
                        StripeRows="true" Header="false" Border="false" Collapsible="true">
                        <TopBar>
                            <ext:Toolbar ID="MainToolBar" runat="server">
                                <Items>
                                    <ext:Button ID="BtnAdd" runat="server" Text="添加" Icon="Add">
                                        <Listeners>
                                            <Click Handler="#{d201_MainForm}.getForm().reset();#{Hid}.setValue('');#{d201_Win}.show();" />
                                        </Listeners>
                                    </ext:Button>
                                    <ext:Button ID="BtnDel" runat="server" Text="删除" Icon="Delete">
                                        <DirectEvents>
                                            <Click OnEvent="BtnDel_Click">
                                                <Confirmation ConfirmRequest="true" Title="确认" Message="确实要删除吗?" />
                                                <EventMask ShowMask="true" Msg="正在删除数据，请等候 ..." />
                                            </Click>
                                        </DirectEvents>
                                        <Listeners>
                                            <Click Handler="if(#{d201_Grid}.getSelectionModel().getCount()<=0) {TellAlert('请选择要删除的记录');return false;}" />
                                        </Listeners>
                                    </ext:Button>
                                    <ext:ToolbarSeparator />
                                    <ext:Button ID="BtnReload" runat="server" Text="重新加载" Icon="Reload">
                                        <Listeners>
                                            <Click Handler="#{d201_MainStore}.reload();" />
                                        </Listeners>
                                    </ext:Button>
                                    <ext:ToolbarFill />
                                    <ext:Button ID="BtnToExcel" runat="server" Text="To Excel" AutoPostBack="true" OnClick="BtnSaveToExcel"
                                        Icon="PageExcel">
                                        <Listeners>
                                            <Click Handler="#{ExcelGridData}.setValue(Ext.encode(d201_Grid.getRowsValues(false)));" />
                                        </Listeners>
                                        <ToolTips>
                                            <ext:ToolTip Title="将当前页内容存储为Excel文件">
                                            </ext:ToolTip>
                                        </ToolTips>
                                    </ext:Button>
                                </Items>
                            </ext:Toolbar>
                        </TopBar>
                        <ColumnModel ID="d201_ColumnMode" runat="server">
                            <Columns>
                                <ext:RowNumbererColumn Width="20" />
                                <ext:Column Header="主键" Sortable="true" Hidden="true" DataIndex="dzbm" />
                                
								<ext:Column Header="gldm" Sortable="true" DataIndex="gldm" />
								<ext:Column Header="dzmc" Sortable="true" DataIndex="dzmc" />
								<ext:Column Header="dqbm" Sortable="true" DataIndex="dqbm" />
								<ext:Column Header="jtdz" Sortable="true" DataIndex="jtdz" />
								<ext:Column Header="zbh" Sortable="true" DataIndex="zbh" />
								<ext:Column Header="cbh" Sortable="true" DataIndex="cbh" />
								<ext:Column Header="djjb" Sortable="true" DataIndex="djjb" />
								<ext:Column Header="xzjb" Sortable="true" DataIndex="xzjb" />
								<ext:Column Header="sxzs" Sortable="true" DataIndex="sxzs" />
								<ext:Column Header="xzcs" Sortable="true" DataIndex="xzcs" />
								<ext:Column Header="xszs" Sortable="true" DataIndex="xszs" />
								<ext:Column Header="nyhs" Sortable="true" DataIndex="nyhs" />
								<ext:Column Header="czrs" Sortable="true" DataIndex="czrs" />
								<ext:Column Header="nyrs" Sortable="true" DataIndex="nyrs" />
								<ext:Column Header="wbhs" Sortable="true" DataIndex="wbhs" />
								<ext:Column Header="pkrs" Sortable="true" DataIndex="pkrs" />
								<ext:Column Header="tkrs" Sortable="true" DataIndex="tkrs" />
								<ext:Column Header="zzrs" Sortable="true" DataIndex="zzrs" />
								<ext:Column Header="chrs" Sortable="true" DataIndex="chrs" />

                            </Columns>
                        </ColumnModel>
                        <Listeners>
                            <RowDblClick Handler="SetWinData(rowIndex);" />
                        </Listeners>
                        <Plugins>
                            <ext:GridFilters runat="server" FiltersText="查找" ID="d201_Filter">
                                <Filters>
                                    
								<ext:StringFilter DataIndex="gldm" />
								<ext:StringFilter DataIndex="dzmc" />
								<ext:StringFilter DataIndex="dqbm" />
								<ext:StringFilter DataIndex="jtdz" />
								<ext:StringFilter DataIndex="zbh" />
								<ext:StringFilter DataIndex="cbh" />
								<ext:StringFilter DataIndex="djjb" />

                                </Filters>
                            </ext:GridFilters>
                        </Plugins>
                        <LoadMask ShowMask="true" Msg="正在加载..." />
                        <SelectionModel>
                            <ext:CheckboxSelectionModel ID="CheckBoxGrid" runat="server" />
                        </SelectionModel>
                        <BottomBar>
                            <ext:PagingToolbar ID="PagingToolBar" StoreID="d201_MainStore" PageSize="15" runat="server" />
                        </BottomBar>
                    </ext:GridPanel>
                </Items>
            </ext:FitLayout>
        </Items>
    </ext:Viewport>
    
    <!--d201表修改，添加主窗体-->
    <ext:Window ID="d201_Win" Collapsible="true" Hidden="true" Modal="true"
        Maximizable="true" runat="server" Title="添加/修改记录" Icon="WorldEdit" Width="630" AutoHeight="true"
        Resizable="true">
        <Items>
            <ext:Hidden ID="Hid" runat="server">
            </ext:Hidden>
            <ext:FormPanel ID="d201_MainForm" LabelWidth="65" Frame="true" runat="server"
                Border="false" Height="300" Padding="5" Icon="UserAdd" Layout="Column">
                <Items>
                    <ext:Panel runat="server" Border="false" Header="false" ColumnWidth=".5" Layout="Form">
                        <Items>
                            
							<ext:TextField ID="Txtgldm" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="gldm" />
							<ext:TextField ID="Txtdqbm" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="dqbm" />
							<ext:TextField ID="Txtzbh" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="zbh" />
							<ext:TextField ID="Txtdjjb" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="djjb" />
							<ext:NumberField ID="TxtNumsxzs" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="sxzs" />
							<ext:NumberField ID="TxtNumxszs" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="xszs" />
							<ext:NumberField ID="TxtNumczrs" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="czrs" />
							<ext:NumberField ID="TxtNumwbhs" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="wbhs" />
							<ext:NumberField ID="TxtNumtkrs" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="tkrs" />
							<ext:NumberField ID="TxtNumchrs" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="chrs" />

                        </Items>
                    </ext:Panel>
                    <ext:Panel runat="server" Border="false" Header="false" ColumnWidth=".5" Layout="Form">
                        <Items> 
                            
							<ext:TextField ID="Txtdzmc" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="dzmc" />
							<ext:TextField ID="Txtjtdz" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="jtdz" />
							<ext:TextField ID="Txtcbh" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="cbh" />
							<ext:NumberField ID="TxtNumxzjb" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="xzjb" />
							<ext:NumberField ID="TxtNumxzcs" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="xzcs" />
							<ext:NumberField ID="TxtNumnyhs" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="nyhs" />
							<ext:NumberField ID="TxtNumnyrs" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="nyrs" />
							<ext:NumberField ID="TxtNumpkrs" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="pkrs" />
							<ext:NumberField ID="TxtNumzzrs" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="zzrs" />

                        </Items>
                    </ext:Panel>
                </Items>
            </ext:FormPanel>
        </Items>
        <Buttons> 
            <ext:Button Text="提交" ID="BtnSave" runat="server" Icon="Disk">
                <DirectEvents>
                    <Click OnEvent="BtnSave_Click">
                        <EventMask ShowMask="true" Msg="正在提交，请等候 ..."  />
                    </Click>
                </DirectEvents>
                <Listeners>
                    <Click Handler="if (#{d201_MainForm}.getForm().isValid()) {;}else{Ext.Msg.show({icon: Ext.MessageBox.ERROR, msg: '您填写的信息不正确，请您确认！', buttons:Ext.Msg.OK});return false;}" />
                </Listeners>
            </ext:Button>
            <ext:Button Text="取消" ID="BtnConcel" Icon="Delete">
                <Listeners>
                    <Click Handler="#{d201_Win}.hide();" />
                </Listeners>
            </ext:Button>
        </Buttons>
    </ext:Window>
    </form>
</body>
</html>
